package org.sky.cloud.common.executor;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ExecutorFactory {

    public static ExecutorService newSingleExecutorService(){
        return Executors.newFixedThreadPool(1);
    }

    public static class Manager{

        private static final ThreadPoolManager threadPoolManager = new ThreadPoolManager();

        public static ExecutorService newSingleExecutorService(String name){
            ExecutorService executorService = ExecutorFactory.newSingleExecutorService();
            threadPoolManager.registerExecutor(name, executorService);
            return executorService;
        }

    }
}
